<table summary="" id="pagehead" cellpadding="0" cellspacing="0" border="0" width="100%">
	<tr>
		<td><h1>公告管理</h1></td>
		<td class="actions">
			<table summary="" cellpadding="0" cellspacing="0" border="0" align="right">
				<tr>
					<td <?=$this->view_act ?>><a href="<?='?app='.APP.'&mod=gonggao';?>">浏览</a></td>
					<td <?=$this->add_act ?>><a href="<?='?app='.APP.'&mod=add';?>">添加</a></td>
					<td <?=$this->edit_act ?>><a>编辑</a></td>
				</tr>
			</table>
		</td>
	</tr>
</table>
<?php if($this->opt=='view'): ?>

<script>
$(function(){
	// 删除
    $('img[del]').click(function (){
        var sid = $(this).attr('del');
        if(confirm('真的要删吗？')) {
            $.getJSON('?app=<?php echo APP; ?>&mod=delete',{sid:sid},function(data){
                if (data.state <= 0)
                {
                    alert(data.message);
                    return false;
                }
				alert(data.message);
				location.href = "?app=source&mod=gonggao";
            });
        }
    });
});
</script>
<div class="line_1"></div>
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="table1">
       <tr>
            <th class="th0">编号</th>
            <th class="th1">时间</th>
			<th class="th1">内容</th>
            <th class="th0">操作</a>
       </tr>
      	 <?php foreach((array)$this->gonggaos as $gonggao): ?>
       	<tr>
            <td><?=$gonggao['sid']; ?></td>
            <td><?=date('Y-m-d',$gonggao['createdate']);?></td>
			<td><?=$gonggao['content']; ?></td>
            <td>
            	<?php echo opt('edit','?app=source&mod=edit&sid='.$gonggao['sid'],'title="编辑"'); ?> &nbsp;|&nbsp;
                <?php echo opt('trash','javascript:;','del="'.$gonggao['sid'].'"  title="删除"'); ?>
            	
            </td>
         </tr>
       <?php endforeach; ?>
</table>
<?php elseif($this->opt=='add'): ?>
<script>
$(function(){
	$('#form').submit(function(){
        // ajax发送数据
        $.post(location.href,$(this).serialize(),function(data){
            if (data.state <= 0)
            {
                $('#'+data.extra).focus();
                alert(data.message);
                return false;
            }
			alert(data.message);
			location.href = "?app=source&mod=gonggao";
        },'json');
        return false;
    });
});

</script>
<div class="edit_tab tab">
<div class="bg1">
<div class="bg2">
      <span rel="info" class="span_now">添加公告</span>
</div>
</div>
</div>
<form id="form">
<div class="post_form" id="info_form">
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="info_table">
		<tr>
			<td class="td1">内容：</td>
			<td>
            	<span>
                <textarea   name="content" id="content" rows="10" cols="100"></textarea>
                </span>
            </td>
		</tr>
        <tr>
        	<td class="td1" colspan="2" style="text-align:center;"><input type="submit" value="提交"/>
               </td>		
		</tr>
     </table>
</div>
</form>
<?php elseif($this->opt=='edit'): ?>
<script>
$(function(){
	$('#form').submit(function(){
        // ajax发送数据
        $.post(location.href,$(this).serialize(),function(data){
            if (data.state <= 0)
            {
                $('#'+data.extra).focus();
                alert(data.message);
                return false;
            }
			alert(data.message);
			location.href = "?app=source&mod=gonggao";
        },'json');
        return false;
    });
});
</script>
<div class="edit_tab tab">
<div class="bg1">
<div class="bg2">
      <span rel="info" class="span_now">编辑公告</span>
</div>
</div>
</div>
<form id="form">
<div class="post_form" id="info_form">
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="info_table">
		<tr>
			<td class="td1">内容：</td>
			<td>
            	<span>
                <textarea   name="content" id="content"  rows="20" cols="40"><?php echo $this->gonggao['content']; ?></textarea></span>
            </td>
		</tr>
        <tr>
        	<td class="td1" colspan="2" style="text-align:center;"><input type="submit" value="提交"/>
                 <input type="hidden" id="sid" name="sid" value="<?=$this->gonggao['sid']; ?>"/></td>		
		</tr>
     </table>
</div>
</form>
<?php endif; ?>